﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using POS_NEW.Client.Function;
using CrystalDecisions.CrystalReports.Engine;

namespace POS_NEW
{
    public partial class frmKiemKho_XuatPhieu : Form
    {
        report.rptKiemKho_XuatPhieu rpt;
        public frmKiemKho_XuatPhieu()
        {
            InitializeComponent();
            this.KeyPreview = true;
        }
        private void LoadRePort()
        {
            rpt = new report.rptKiemKho_XuatPhieu();
            frmKiemKho frm = new frmKiemKho();

            frmKiemKho.tbKiemKhoCapNhat.TableName="tbKiemKhoCapNhat";
            rpt.SetDataSource(frmKiemKho.tbKiemKhoCapNhat);
            myProgress.SubReportHeader(rpt);
            crystalReportViewer1.ReportSource = rpt;
            
        }
        private void frmKiemKho_XuatPhieu_Load(object sender, EventArgs e)
        {
            LoadRePort();
        }

        private void frmKiemKho_XuatPhieu_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F2)
            {
                this.DialogResult = DialogResult.OK;
                rpt.Dispose();
            }
            else
                if (e.KeyCode == Keys.Escape)
                {
                    this.DialogResult = DialogResult.Cancel;
                    rpt.Dispose();
                }
                else
                    if (e.KeyCode == Keys.Right)
                        this.crystalReportViewer1.ShowNextPage();
                    else
                        if (e.KeyCode == Keys.Left)
                            this.crystalReportViewer1.ShowPreviousPage();
        }
    }
}
